var t = getApp();

Page({
    data: {
        language: "",
        goodsrange: [],
        fenleirange: [],
        category: [],
        goods: [],
        goodsSelect: [],
        fenleiSelect: [],
        sousuoInfo: [],
        goodsSousuo: [],
        keyword: "",
        goodsKeyword: "",
        show3: !1,
        show1: !1,
        show2: !1,
        status: "1",
        is_complex: "0",
        level_limit: "-1",
        coupon_method: "1",
        display_order: "",
        enough: "",
        use_type: "5",
        get_type: "1",
        name: "",
        deduct: "",
        discount: "",
        time_days: "",
        time_start: "",
        time_end: "",
        dataInfo: {},
        get_max: 1,
        total: 1,
        onceTotal: "",
        id: "",
        Id: "",
        Vip: [],
        chooseVip: "所有会员",
        time_limit: "0",
        show4: !1,
        show5: !1,
        checked: !1,
        time_startTimes: "",
        time_endTimes: "",
        formatter: function(t, e) {
            return "year" === t ? "".concat(e, "年") : "month" === t ? "".concat(e, "月") : "day" === t ? "".concat(e, "日") : "hour" === t ? "".concat(e, "时") : "minute" === t ? "".concat(e, "分") : e;
        },
        minDate: new Date().getTime(),
        sendBtnFlag: !1
    },
    onLoad: function(t) {
        this.setData({
            time_start: this.format(new Date().getTime()),
            time_end: this.format(new Date().getTime())
        }), void 0 === this.options.id ? wx.navigateBack({
            delta: 1
        }) : "abc" === this.options.id ? (this.getData(), wx.setNavigationBarTitle({
            title: "优惠券发布"
        }), this.setData({
            Id: t.id
        })) : (wx.setNavigationBarTitle({
            title: "优惠券编辑"
        }), this.setData({
            id: t.id
        }), this.getData());
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    timestampToTime: function(t) {
        var e = new Date(1e3 * t);
        return e.getFullYear() + "-" + ((e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1) + "-") + (this.change(e.getDate()) + " ") + (this.change(e.getHours()) + ":") + this.change(e.getMinutes());
    },
    change: function(t) {
        return t < 10 ? "0" + t : t;
    },
    getData: function() {
        var e = this, a = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.edit");
        a += "&id=" + this.data.id, t._getNetWork({
            url: a,
            success: function(t) {
                var a = t.data;
                if (1 == a.result) if (e.data.id) {
                    if (e.setData({
                        dataInfo: a.data,
                        status: String(a.data.status),
                        is_complex: String(a.data.is_complex),
                        coupon_method: String(a.data.coupon_method),
                        use_type: String(a.data.use_type),
                        get_type: String(a.data.get_type),
                        level_limit: String(a.data.level_limit),
                        enough: a.data.enough,
                        display_order: a.data.display_order,
                        name: a.data.name,
                        time_limit: String(a.data.time_limit),
                        onceTotal: a.data.get_limit_max
                    }), 0 == a.data.time_limit && e.setData({
                        time_days: a.data.time_days
                    }), 1 == a.data.time_limit) {
                        e.setData({
                            time_start: e.timestampToTime(a.data.time_start),
                            time_end: e.timestampToTime(a.data.time_end)
                        });
                        var i = new Date(e.data.time_start);
                        i = i.getTime(), console.log(i, "211221122112");
                        var s = new Date(e.data.time_end);
                        s = s.getTime(), e.setData({
                            time_startTimes: i,
                            time_endTimes: s
                        });
                    }
                    1 == e.data.coupon_method && e.setData({
                        deduct: a.data.deduct
                    }), 2 == e.data.coupon_method && e.setData({
                        discount: a.data.discount
                    }), 1 == e.data.use_type && e.setData({
                        category: a.data.category
                    }), 2 == e.data.use_type && e.setData({
                        goods: a.data.goods
                    }), e.setData({
                        Vip: a.data.memberLevels,
                        get_max: a.data.get_max,
                        total: a.data.total
                    });
                    for (var o = 0; o < e.data.Vip.length; o++) a.data.level_limit == e.data.Vip[o].id && e.setData({
                        chooseVip: "会员".concat(e.data.Vip[o].level_name)
                    });
                } else e.setData({
                    Vip: a.data.memberLevels
                }); else 0 === a.result && (a.data.url || wx.showToast({
                    title: a.msg,
                    icon: "none"
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    classifyDelete: function(t) {
        for (var e = t.target.dataset.item || t.currentTarget.dataset.item, a = this.data.fenleirange, i = 0; i < a.length; i++) e.id == a[i].id && a.splice(i, 1);
        this.setData({
            fenleirange: a
        });
    },
    goodsDelete: function(t) {
        for (var e = t.target.dataset.item || t.currentTarget.dataset.item, a = this.data.goodsrange, i = 0; i < a.length; i++) e.id == a[i].id && a.splice(i, 1);
        this.setData({
            goodsrange: a
        });
    },
    classifyDDelete: function(t) {
        for (var e = t.target.dataset.item || t.currentTarget.dataset.item, a = this.data.category, i = 0; i < a.length; i++) e.id == a[i].id && a.splice(i, 1);
        this.setData({
            category: a
        });
    },
    goodsDDelete: function(t) {
        for (var e = t.target.dataset.item || t.currentTarget.dataset.item, a = this.data.goods, i = 0; i < a.length; i++) e.id == a[i].id && a.splice(i, 1);
        this.setData({
            goods: a
        });
    },
    inniClassify: function() {
        this.setData({
            show2: !0,
            sousuoInfo: [],
            keyword: ""
        });
    },
    inniGoods: function() {
        this.setData({
            show3: !0,
            goodsSousuo: [],
            goodsKeyword: ""
        });
    },
    close: function() {
        this.setData({
            show1: !1
        });
    },
    closeClassify: function() {
        this.setData({
            show2: !1,
            fenleiSelect: []
        });
    },
    closeGoods: function() {
        this.setData({
            show3: !1,
            goodsSelect: []
        });
    },
    finishClassify: function() {
        var t = this.data.fenleiSelect, e = this.data.sousuoInfoAllOIs, a = this.data.fenleirange;
        e.map(function(e) {
            for (var i = 0; i < t.length; i++) e.name == t[i] && a.push(e);
        }), this.setData({
            show2: !1,
            fenleirange: a,
            fenleiSelect: []
        });
    },
    finishcategory: function() {
        var t = this.data.sousuoInfoSearch, e = this.data.fenleiSelect, a = this.data.category;
        t.map(function(t) {
            for (var i = 0; i < e.length; i++) t.name == e[i] && a.push(t);
        }), this.setData({
            show2: !1,
            category: a,
            fenleiSelect: []
        });
    },
    deteleObject: function(t) {
        for (var e = [], a = {}, i = 0; i < t.length; i++) {
            var s = Object.keys(t[i]);
            s.sort(function(t, e) {
                return Number(t) - Number(e);
            });
            for (var o = "", n = 0; n < s.length; n++) o += JSON.stringify(s[n]), o += JSON.stringify(t[i][s[n]]);
            a.hasOwnProperty(o) || (e.push(t[i]), a[o] = !0);
        }
        return e;
    },
    finishGoods: function() {
        var t = this, e = this.data.goodsrange;
        this.data.goodsSousuo.map(function(a) {
            for (var i = 0; i < t.data.goodsSelect.length; i++) a.title == t.data.goodsSelect[i] && e.push(a);
        }), this.setData({
            show3: !1,
            goodsrange: e,
            goodsSelect: []
        });
    },
    finishgoods: function() {
        var t = this.data.goodsSousuoAll, e = this.data.goodsSelect, a = this.data.goods;
        t.map(function(t) {
            for (var i = 0; i < e.length; i++) t.title == e[i] && a.push(t);
        }), this.setData({
            show3: !1,
            goods: a,
            goodsSelect: []
        });
    },
    ClassifySousuo: function() {
        var e = this;
        if (t._isTextEmpty(this.data.keyword)) wx.showToast({
            title: "请输入搜索内容",
            icon: "none"
        }); else {
            var a = {
                keyword: this.data.keyword
            }, i = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.getSearchCategories");
            t._postNetWork({
                url: i,
                data: a,
                success: function(t) {
                    var a = t.data, i = a.data, s = e.data.fenleirange, o = [];
                    if (s.length > 0) {
                        var n = [];
                        s.forEach(function(t) {
                            n.push(t.id);
                        }), o = i.filter(function(t) {
                            return -1 == n.indexOf(t.id);
                        });
                    }
                    0 == s.length && (o = i), 1 == a.result ? e.setData({
                        sousuoInfo: o,
                        sousuoInfoAllOIs: a.data
                    }) : 0 === a.result ? a.data.url : wx.showToast({
                        title: a.msg,
                        icon: "none"
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    categorySousuo: function() {
        var e = this;
        if (t._isTextEmpty(this.data.keyword)) wx.showToast({
            title: "请输入搜索内容",
            icon: "none"
        }); else {
            var a = {
                keyword: this.data.keyword
            }, i = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.getSearchCategories");
            t._postNetWork({
                url: i,
                data: a,
                success: function(t) {
                    var a = t.data;
                    if (1 == a.result) {
                        var i = a.data, s = e.data.category, o = [];
                        if (s.length > 0) {
                            var n = [];
                            s.forEach(function(t) {
                                n.push(t.id);
                            }), o = i.filter(function(t) {
                                return -1 == n.indexOf(t.id);
                            });
                        } else s.length <= 0 && (o = i);
                        e.setData({
                            sousuoInfo: o,
                            sousuoInfoSearch: a.data
                        });
                    } else 0 === a.result ? a.data.url : wx.showToast({
                        title: a.msg,
                        icon: "none"
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    goodsousuo: function() {
        var e = this;
        if (t._isTextEmpty(this.data.goodsKeyword)) wx.showToast({
            title: "请输入搜索内容",
            icon: "none"
        }); else {
            var a = {
                keyword: this.data.goodsKeyword
            }, i = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.getSearchGoods");
            t._postNetWork({
                url: i,
                data: a,
                success: function(t) {
                    var a = t.data;
                    if (1 == a.result) {
                        var i = e.data.goodsrange, s = a.data, o = [];
                        if (i.length > 0) {
                            var n = [];
                            i.forEach(function(t) {
                                n.push(t.id);
                            }), o = s.filter(function(t) {
                                return -1 == n.indexOf(t.id);
                            });
                        } else i.length <= 0 && (o = s);
                        e.setData({
                            goodsSousuo: o,
                            goodSousuoAll: a.data
                        });
                    } else 0 === a.result ? a.data.url : wx.showToast({
                        title: a.msg,
                        icon: "none"
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    goodSousuo: function() {
        var e = this;
        if (t._isTextEmpty(this.data.goodsKeyword)) wx.showToast({
            title: "请输入搜索内容",
            icon: "none"
        }); else {
            var a = {
                keyword: this.data.goodsKeyword
            }, i = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.getSearchGoods");
            t._postNetWork({
                url: i,
                data: a,
                success: function(t) {
                    var a = t.data;
                    if (1 == a.result) {
                        var i = e.data.goods, s = a.data, o = [];
                        if (i.length > 0) {
                            var n = [];
                            i.forEach(function(t) {
                                n.push(t.id);
                            }), o = s.filter(function(t) {
                                return -1 == n.indexOf(t.id);
                            });
                        } else i.length <= 0 && (o = s);
                        e.setData({
                            goodsSousuo: o,
                            goodsSousuoAll: a.data
                        });
                    } else 0 === a.result ? a.data.url : wx.showToast({
                        title: a.msg,
                        icon: "none"
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    finish: function() {
        if (this.setData({
            show1: !1
        }), -1 == this.data.level_limit) this.setData({
            chooseVip: "所有会员"
        }); else for (var t = 0; t < this.data.Vip.length; t++) this.data.level_limit == this.data.Vip[t].id && this.setData({
            chooseVip: "会员".concat(this.data.Vip[t].level_name)
        });
    },
    publishInfo: function() {
        var e = this;
        if (1 != this.data.sendBtnFlag) if (t._isTextEmpty(this.data.display_order) || isNaN(this.data.display_order)) wx.showToast({
            title: "请输入排序方法，必须是整数",
            icon: "none"
        }); else if (t._isTextEmpty(this.data.name)) wx.showToast({
            title: "请输入优惠券名称",
            icon: "none"
        }); else if (t._isTextEmpty(this.data.enough) || isNaN(this.data.enough)) wx.showToast({
            title: "请输入订单金额,必须是整数",
            icon: "none"
        }); else if (0 == this.data.time_limit && t._isTextEmpty(this.data.time_days)) wx.showToast({
            title: "请输入有效天数",
            icon: "none"
        }); else {
            if (1 == this.data.time_limit) if ("android" == t.isIosOrAndroid()) {
                if (new Date(this.data.time_start).getTime() >= new Date(this.data.time_end).getTime()) return void wx.showToast({
                    title: "开始时间必须早于结束时间",
                    icon: "none"
                });
            } else if (parseInt(Date.parse(new Date(this.data.time_start.replace(/-/g, "/")))) >= parseInt(Date.parse(new Date(this.data.time_end.replace(/-/g, "/"))))) return void wx.showToast({
                title: "开始时间必须早于结束时间",
                icon: "none"
            });
            if (1 === this.data.coupon_method) {
                if (t._isTextEmpty(this.deduct)) return void wx.showToast({
                    title: "请输入立减金额",
                    icon: "none"
                });
                if (Number(this.data.deduct < 1)) return void wx.showToast({
                    title: "金额必须大于1",
                    icon: "none"
                });
                if (Number(this.data.deduct) > Number(this.data.enough)) {
                    var a = "输入的金额必须介于1-".concat(this.data.enough, "之间");
                    return void wx.showToast({
                        title: a,
                        icon: "none"
                    });
                }
            }
            if (2 === this.data.coupon_method) {
                if (t._isTextEmpty(this.data.discount)) return void wx.showToast({
                    title: "请输入折扣数",
                    icon: "none"
                });
                if (Number(this.data.discount < 1) || Number(this.data.discount >= 10)) {
                    return void wx.showToast({
                        title: "折扣数必须介于1-9之间",
                        icon: "none"
                    });
                }
            }
            if (1 === this.data.use_type && this.data.fenleirange.length <= 0) wx.showToast({
                title: "分类不能为空",
                icon: "none"
            }); else if (2 === this.data.use_type && this.data.goodsrange.length <= 0) wx.showToast({
                title: "商品不能为空",
                icon: "none"
            }); else {
                if (1 === this.data.get_type) {
                    if (t._isTextEmpty(this.data.get_max)) return void wx.showToast({
                        title: "请输入限领张数",
                        icon: "none"
                    });
                    if (t._isTextEmpty(this.data.total)) return void wx.showToast({
                        title: "请输入发放总数",
                        icon: "none"
                    });
                }
                if (0 === this.data.get_type && t._isTextEmpty(this.data.total)) wx.showToast({
                    title: "请输入发放总数",
                    icon: "none"
                }); else {
                    this.data.sendBtnFlag = !0;
                    var i = new Date(this.data.time_start.replace(/-/g, "/"));
                    i = i.getTime() / 1e3;
                    var s = new Date(this.data.time_end.replace(/-/g, "/"));
                    s = s.getTime() / 1e3;
                    var o = this.data.goodSousuoAll, n = this.data.goodsrange, d = [];
                    "2" == this.data.use_type && o.map(function(t) {
                        for (var e = 0; e < n.length; e++) t.id == n[e].id && d.push(t);
                    });
                    var l = {
                        coupon: {
                            name: this.data.name,
                            get_type: this.data.get_type,
                            level_limit: this.data.level_limit,
                            use_type: this.data.use_type,
                            enough: this.data.enough,
                            time_limit: this.data.time_limit,
                            time_days: this.data.time_days,
                            time_start: i,
                            time_end: s,
                            coupon_method: this.data.coupon_method,
                            discount: this.data.discount,
                            deduct: this.data.deduct,
                            total: this.data.total,
                            status: this.data.status,
                            display_order: this.data.display_order,
                            is_complex: this.data.is_complex,
                            get_max: this.data.get_max,
                            category: this.data.fenleirange,
                            goods: d,
                            get_limit_max: this.data.onceTotal ? this.data.onceTotal : 0
                        }
                    };
                    "1" == this.data.use_type ? l.coupon.goods = [] : "2" == this.data.use_type && (l.coupon.category = []);
                    var r = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.save");
                    t._postNetWork({
                        url: r,
                        data: l,
                        success: function(t) {
                            var a = t.data;
                            1 == a.result ? (wx.showToast({
                                title: "发布成功"
                            }), setTimeout(function() {
                                wx.navigateBack({
                                    delta: 1
                                });
                            }, 2e3)) : 0 === a.result && (a.data.url || wx.showToast({
                                title: a.msg || a.msg.deduct[0],
                                icon: "none"
                            }), e.data.sendBtnFlag = !1);
                        },
                        fail: function(t) {
                            e.data.sendBtnFlag = !1, console.log(t);
                        }
                    });
                }
            }
        }
    },
    editInfo: function() {
        var e = this;
        if (1 != this.data.sendBtnFlag) if (t._isTextEmpty(this.data.display_order) || isNaN(this.data.display_order)) wx.showToast({
            title: "请输入排序方法，必须是整数",
            icon: "none"
        }); else if (t._isTextEmpty(this.data.name)) wx.showToast({
            title: "请输入优惠券名称",
            icon: "none"
        }); else if (t._isTextEmpty(this.data.enough) || isNaN(this.data.enough)) wx.showToast({
            title: "请输入订单金额,必须是整数",
            icon: "none"
        }); else if (0 == this.data.time_limit && t._isTextEmpty(this.data.time_days)) wx.showToast({
            title: "请输入有效天数",
            icon: "none"
        }); else {
            if (1 == this.data.time_limit) if ("android" == t.isIosOrAndroid()) {
                if (new Date(this.data.time_start).getTime() >= new Date(this.data.time_end).getTime()) return void wx.showToast({
                    title: "开始时间必须早于结束时间",
                    icon: "none"
                });
            } else if (parseInt(Date.parse(new Date(this.data.time_start.replace(/-/g, "/")))) >= parseInt(Date.parse(new Date(this.data.time_end.replace(/-/g, "/"))))) return void wx.showToast({
                title: "开始时间必须早于结束时间",
                icon: "none"
            });
            if (1 === this.data.coupon_method) {
                if (t._isTextEmpty(this.data.deduct)) return void wx.showToast({
                    title: "请输入立减金额",
                    icon: "none"
                });
                if (this.data.deduct < 1) return void wx.showToast({
                    title: "金额必须大于1",
                    icon: "none"
                });
                if (this.data.deduct > this.data.enough) {
                    var a = "输入的金额必须介于1-".concat(this.enough, "之间");
                    return void wx.showToast({
                        title: a,
                        icon: "none"
                    });
                }
            }
            if (2 === this.data.coupon_method) {
                if (t._isTextEmpty(this.data.discount)) return void wx.showToast({
                    title: "请输入折扣数",
                    icon: "none"
                });
                if (this.data.discount < 1 || this.data.discount > 10) {
                    return void wx.showToast({
                        title: "折扣数必须介于1-10之间",
                        icon: "none"
                    });
                }
            }
            if (1 === this.data.use_type && this.data.category.length <= 0) wx.showToast({
                title: "分类不能为空",
                icon: "none"
            }); else if (2 === this.data.use_type && this.data.goods.length <= 0) wx.showToast({
                title: "商品不能为空",
                icon: "none"
            }); else {
                if (1 === this.data.get_type) {
                    if (t._isTextEmpty(this.data.get_max)) return void wx.showToast({
                        title: "请输入限领张数",
                        icon: "none"
                    });
                    if (t._isTextEmpty(this.data.total)) return void wx.showToast({
                        title: "请输入发放总数",
                        icon: "none"
                    });
                }
                if (0 === this.data.get_type && t._isTextEmpty(this.data.total)) wx.showToast({
                    title: "请输入发放总数",
                    icon: "none"
                }); else {
                    this.data.sendBtnFlag = !0;
                    var i = new Date(this.data.time_start.replace(/-/g, "/"));
                    i = i.getTime() / 1e3;
                    var s = new Date(this.data.time_end.replace(/-/g, "/"));
                    s = s.getTime() / 1e3;
                    var o = {
                        coupon: {
                            id: this.data.id,
                            name: this.data.name,
                            get_type: this.data.get_type,
                            level_limit: this.data.level_limit,
                            use_type: this.data.use_type,
                            enough: this.data.enough,
                            time_limit: this.data.time_limit,
                            time_days: this.data.time_days,
                            time_start: i,
                            time_end: s,
                            coupon_method: this.data.coupon_method,
                            discount: this.data.discount,
                            deduct: this.data.deduct,
                            total: this.data.total,
                            status: this.data.status,
                            display_order: this.data.display_order,
                            is_complex: this.data.is_complex,
                            get_max: this.data.get_max,
                            category: this.data.category,
                            goods: this.data.goods,
                            get_limit_max: this.data.onceTotal ? this.data.onceTotal : 0
                        }
                    };
                    1 == this.data.use_type ? o.coupon.goods = [] : 2 == this.data.use_type && (o.coupon.category = []);
                    var n = t.getNetAddresss("plugin.store-cashier.frontend.store.center.coupon.save");
                    t._postNetWork({
                        url: n,
                        data: o,
                        success: function(t) {
                            var a = t.data;
                            1 == a.result ? (wx.showToast({
                                title: "保存成功"
                            }), setTimeout(function() {
                                wx.navigateBack({
                                    delta: 1
                                });
                            }, 2e3)) : 0 === a.result && (a.data.url || wx.showToast({
                                title: a.msg || a.msg.discount[0],
                                icon: "none"
                            }), e.data.sendBtnFlag = !1);
                        },
                        fail: function(t) {
                            e.data.sendBtnFlag = !1, console.log(t);
                        }
                    });
                }
            }
        }
    },
    onChange: function(t) {
        this.setData({
            status: t.detail
        });
    },
    onChangeData: function(t) {
        if ("1" == t.detail) {
            var e = new Date(this.data.time_start);
            e = e.getTime();
            var a = new Date(this.data.time_end);
            a = a.getTime(), this.setData({
                time_startTimes: e,
                time_endTimes: a
            });
        }
        this.setData({
            time_limit: t.detail
        });
    },
    onChangeNum: function(t) {
        this.setData({
            is_complex: t.detail
        });
    },
    onChangeAdd: function(t) {
        this.setData({
            coupon_method: t.detail
        });
    },
    onChangeCate: function(t) {
        this.setData({
            use_type: t.detail
        });
    },
    onChangeforu: function(t) {
        this.setData({
            get_type: t.detail
        });
    },
    onChangeLimt: function(t) {
        "-1" != t.detail ? this.setData({
            level_limit: parseInt(t.detail)
        }) : this.setData({
            level_limit: t.detail
        });
    },
    onCloseShow: function() {
        this.setData({
            show3: !1,
            show1: !1,
            show2: !1,
            show4: !1,
            show5: !1
        });
    },
    clearSrcoll: function(t) {
        console.log(t.detail, "测试"), this.setData({
            goodsKeyword: t.detail
        });
    },
    clearSrcollCate: function(t) {
        this.setData({
            keyword: t.detail
        });
    },
    tapshowMember: function() {
        this.setData({
            show1: !0
        });
    },
    clearSrcollDeduct: function(t) {
        this.setData({
            deduct: t.detail.value
        });
    },
    clearSrcollDis: function(t) {
        this.setData({
            discount: t.detail.value
        });
    },
    clearSrcollSort: function(t) {
        this.setData({
            display_order: t.detail.value
        });
    },
    clearSrcollName: function(t) {
        this.setData({
            name: t.detail.value
        });
    },
    clearSrcollEnough: function(t) {
        this.setData({
            enough: t.detail.value
        });
    },
    clearSrcollTime: function(t) {
        this.setData({
            time_days: t.detail.value
        });
    },
    tapIShow: function() {
        this.setData({
            show4: !0
        });
    },
    tapIShowOne: function() {
        this.setData({
            show5: !0
        });
    },
    onInput: function() {
        this.setData({
            show4: !1,
            show5: !1
        });
    },
    firmOnye: function(t) {
        if (Number.isNaN(t.detail)) this.setData({
            show4: !1,
            time_start: "2017-05-11"
        }); else {
            var e = this.format(t.detail);
            this.setData({
                show4: !1,
                time_start: e,
                time_startTimes: t.detail
            });
        }
    },
    firmOnyeOpios: function(t) {
        if ("NaN" != t.detail) {
            var e = this.format(t.detail);
            this.setData({
                show5: !1,
                time_end: e,
                time_endTimes: t.detail
            });
        } else this.setData({
            show5: !1,
            time_end: "2017-05-11"
        });
    },
    clearSrcollGetMax: function(t) {
        this.setData({
            get_max: t.detail.value
        });
    },
    clearSrcollTotal: function(t) {
        this.setData({
            total: t.detail.value
        });
    },
    clearSrcollonceTotal: function(t) {
        this.setData({
            onceTotal: t.detail.value
        });
    },
    add0: function(t) {
        return t < 10 ? "0" + t : t;
    },
    format: function(t) {
        var e = new Date(parseInt(t)), a = e.getFullYear(), i = e.getMonth() + 1, s = e.getDate(), o = e.getHours(), n = e.getMinutes();
        return a + "-" + this.add0(i) + "-" + this.add0(s) + " " + this.add0(o) + ":" + this.add0(n);
    },
    onchangeGroup: function(t) {
        this.setData({
            fenleiSelect: t.detail
        });
    },
    onchangeSelect: function(t) {
        this.setData({
            goodsSelect: t.detail
        });
    }
});